//
//  BoatStyleViewController.m
//  shuiyun
//
//  Created by 徐双 on 2017/9/6.
//  Copyright © 2017年 qianyi. All rights reserved.
//

#import "BoatStyleViewController.h"
#import "BoatStyleViewCell.h"

@interface BoatStyleViewController ()<UITableViewDelegate,UITableViewDataSource>

@property (nonatomic, strong) UITableView *tableView;

@end

@implementation BoatStyleViewController

- (void)viewWillAppear:(BOOL)animated{
    
    
    [super viewWillAppear:animated];
    [self.navigationController setNavigationBarHidden:NO animated:NO];
    
}

- (void)viewDidLoad {
    [super viewDidLoad];
    [self creationView];
    [self regeditCell];
    
    // Do any additional setup after loading the view.
}
- (void)creationView {
    [super viewDidLoad];
    
    [self setTitle:@"选择船舶类型"];
    
    
    
    //初始化tableView
    
    self.tableView = [[UITableView alloc] init];
    self.tableView.frame = CGRectMake(0, 0, DEF_SCREEN_WIDTH, DEF_SCREEN_HEIGHT - 64);
    
    
    self.tableView.tableFooterView = [[UITableView alloc] initWithFrame:CGRectZero];
    
    self.tableView.backgroundColor = [UIColor whiteColor];
    
    self.tableView.delegate = self;
    self.tableView.dataSource = self;
    //   self.tableView.estimatedRowHeight = 400;
    self.tableView.separatorStyle = UITableViewCellAccessoryNone;//去掉分割线
    
    
    [self.view addSubview:self.tableView];
    self.view.backgroundColor = [UIColor colorWithRed:245 / 255.0f green:245 / 255.0f blue:245 / 255.0f alpha:1];
    
    UIButton *buttonOut = [[UIButton alloc] init];
    [self.view addSubview:buttonOut];
    [buttonOut mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.view).offset(16);
        make.right.equalTo(self.view).offset(-16);
        make.bottom.equalTo(self.view).offset(-9);
        make.height.offset(40);
        
    }];
    [buttonOut setTitle:@"确认" forState:UIControlStateNormal];
    buttonOut.backgroundColor = getColor(@"3F87F6");
    [buttonOut setTitleColor:getColor(@"FFFFFF") forState:UIControlStateNormal];
    [buttonOut addTarget:self action:@selector(publicLick) forControlEvents:UIControlEventTouchUpInside];
    
}

-(void)publicLick{
    
}


-(void)regeditCell{
    
    [self.tableView registerNib:[UINib nibWithNibName:@"BoatStyleViewCell" bundle:nil] forCellReuseIdentifier:@"BoatStyleViewCell"];
    
    }

#pragma mark - ---------- Cell的数量 ----------
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return 6;
    
    
}

#pragma mark - ---------- 每个Cell的高度 ----------
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    
    return 50;
    
}

#pragma mark - ---------- 每个Cell的内容 ----------
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    
    
    BoatStyleViewCell * cell = [tableView dequeueReusableCellWithIdentifier:@"BoatStyleViewCell"];
    
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    
    if (indexPath.row == 0) {
        
        cell.boatLabel.text = @"散货船";

        
    }else if (indexPath.row == 1){
        
        cell.boatLabel.text = @"集装箱船";

    }else if (indexPath.row == 2){
        
        cell.boatLabel.text = @"多用途船";

    }else if (indexPath.row == 3){
        
        cell.boatLabel.text = @"拖船";

    }else if (indexPath.row == 4){
        
        cell.boatLabel.text = @"油船";

    }else if (indexPath.row == 5){
        
        cell.boatLabel.text = @"甲板船";

    }else {
        
        cell.boatLabel.text = @"吸沙船";

    }
    return cell;
    
}
#pragma mark - ---------- 每个Cell的点击事件 ----------
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    
}

@end
